let s = "test";
//写一个快排的算法
function quickSort(arr) {
    console.log("🚀 ~ index.js:25 ~ 写一个快排的算法:", arr);
    if (arr.length <= 1) {
        return arr;
    }

    const pivotIndex = Math.floor(arr.length / 2);
    const pivot = arr.splice(pivotIndex, 1)[0];

    const left = [];
    const right = [];

    for (let i = 0; i < arr.length; i++) {
        if (arr[i] < pivot) {
            left.push(arr[i]);
        } else {
            right.push(arr[i]);
        }
    }
    return [...quickSort(left), pivot, ...quickSort(right)];
}

let d = quickSort([2, 5, 3, 66, 13]);
console.log("🚀 ~ index.js:25 ~ d:", 'cc');

export default quickSort;
